package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.RefundProduct;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RefundProductDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主表id")
    private Integer id;

    @ApiModelProperty(value = "退款表id")
    private Integer refundId;

    @ApiModelProperty(value = "产品id")
    private Integer productId;

    @ApiModelProperty(value = "退款产品数量")
    private Integer refundNum;

    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "单位名称")
    private String unitName;

    @ApiModelProperty(value = "产品名称")
    private String name;

    @ApiModelProperty(value = "规格类型")
    private String specification;

    @ApiModelProperty(value = "材质")
    private String  vProductMaterial;

    @ApiModelProperty(value = "备注")
    private String  vProductRemark;


    public RefundProductDTO() {}

    public RefundProductDTO(RefundProduct entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static RefundProductDTO convert(RefundProduct entity) {
        return new RefundProductDTO(entity);
    }

    public static List<RefundProductDTO> convertList(List<RefundProduct> list) {
        List<RefundProductDTO> resultList = new ArrayList<>();
        for (RefundProduct entity : list) {
            resultList.add(new RefundProductDTO(entity));
        }
        return resultList;
    }}
